# -*- coding: utf-8 -*-
#  @Time    : 2020/2/23 23:03
#  @Author  : Ben
#  @File    : service.py
from vehicle.models import Vehicle


class VehicleService:
    def select_vehicle(self, user_name):
        """
        用户中心车辆信息查询
        :param user_name:
        :return: QuerySet
        """
        try:
            return_vehicle = Vehicle.vehicle.filter(user_id__userName=user_name)
            print("查询成功")
            print(return_vehicle)
            return return_vehicle
        except Exception:
            print("用户不存在，查询失败")
            return None
